'## Copyright (c) 2011, Hacker Wez under the New BSD License, see glyphx-license.txt (http://glyphx.codeplex.com/)
Public Class optionsForm

    Dim loading As Boolean = True

    Private Sub optionsForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.Text = My.Application.Info.ProductName & " options"
        btnColor.BackColor = My.Forms.canvasForm.background_Color
        chkTrails.Checked = My.Forms.canvasForm.Trails
        txtPopulation.Value = My.Forms.canvasForm.Max_onscreen_glyphs
        loading = False
    End Sub

    Private Sub chkTrails_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles chkTrails.CheckedChanged
        If loading Then Exit Sub
        My.Forms.canvasForm.Trails = chkTrails.Checked
    End Sub

    Private Sub txtPopulation_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtPopulation.ValueChanged
        If loading Then Exit Sub
        My.Forms.canvasForm.Max_onscreen_glyphs = CInt(txtPopulation.Value)
    End Sub

    Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click
        Me.Close()
    End Sub

    Private Sub btnColor_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnColor.Click
        Dim coldlg As New ColorDialog
        coldlg.AllowFullOpen = True
        coldlg.AnyColor = True
        coldlg.Color = My.Forms.canvasForm.background_Color
        coldlg.FullOpen = True
        If coldlg.ShowDialog(Me) = Windows.Forms.DialogResult.OK Then
            My.Forms.canvasForm.background_Color = coldlg.Color
            btnColor.BackColor = coldlg.Color
        End If
    End Sub

End Class